﻿using AbstructFactory;
using Newtonsoft.Json;
using QuartzJob;
using QuartzJob.Jobs;
using System;
using System.Collections.Generic;
using System.EnterpriseServices;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestTest.BPMService;
using XF.Common;
using XF.Common.Redis;
using XF.Common.WeChat;
using XF.Meeting.Common;
using XF.Meeting.Entity.CommonEntity;
using XF.Meeting.Entity.CommonEntity.wx;
using XF.Meeting.Entity.DTO;

namespace TestTest
{
    class Program
    {
        private HttpClientHelper requst = new HttpClientHelper();
        public AbsFactoryTE abs = (AbsFactoryTE)AbsFactory.CreateInterface();
        static void Main(string[] args)
        {
            //   var entity = new ExtendMeeting()
            //   {
            //       BeginTime = DateTime.Now,
            //       CRoomID = "1",
            //       CRoomIDs = "2",
            //       EndTime = DateTime.Now.AddHours(-8),
            //        Extend=1,
            //         ID=1
            //   };
            //   string xml = TableToList.XMLSerialize(entity, Encoding.UTF8);
            //   var bpmEetity = new BPMProcess() {
            //       ProcessNo = "Meeting001",
            //       strBOID = Guid.NewGuid().ToString(),
            //        strBSID="ese",
            //         strBTID="eseCode",
            //          strCurrentUserId="admin",
            //           strTopic="会议预约",
            //            strXML= xml
            //   };
            //   var bpm = new BS_Service();
            //   //发起审批
            //var  result= bpm.StartProcess(bpmEetity.strBSID,bpmEetity.strBTID, bpmEetity.strBOID, bpmEetity.strCurrentUserId, bpmEetity.strTopic, bpmEetity.ProcessNo, bpmEetity.strXML);
            //   var res = TableToList.XMLDeSerialize<response>(result);
            //   var returnStr = TableToList.XMLSerialize(result, Encoding.UTF8);
            //   Console.WriteLine();
            WeChatHelper wx = new WeChatHelper();

            Console.ReadKey();
        }
        public string GetAccessToken(string corpid, string secret)
        {

            var response = requst.Get($"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={secret}");
            // Response.Write(response);
            var aaa = Newtonsoft.Json.JsonConvert.DeserializeObject<XF.Common.WeChat.Root>(response);
            return aaa.access_token;
        }
    }
}
